
#ifndef _NAVI_API_H
#define _NAVI_API_H

#include "../Gui.h"

#ifdef UNDER_CE
//#include <Windev.h>
//#include <Pwinuser.h>
#include <pm.h>
#endif

#include <winioctl.h>
#include <Winbase.h>

#define BKL_STATE_FULLON	4
#define BKL_STATE_ON	3
#define BKL_STATE_EFFICIENT	2
#define BKL_STATE_IDLE	1
#define BKL_STATE_OFF	0

#define BKL_MAX_LEVEL	10
#define BKL_MIN_LEVEL	1

#define BKL_ON			0xff
#define BKL_OFF			0x0

#define IOCTL_BACKLIGHT_SET		CTL_CODE(FILE_DEVICE_UNKNOWN, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_BACKLIGHT_GET		CTL_CODE(FILE_DEVICE_UNKNOWN, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_GET_TOTAL_LEVELS		CTL_CODE(FILE_DEVICE_UNKNOWN, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_BACKLIGHT_SET_MAX		CTL_CODE(FILE_DEVICE_UNKNOWN, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_BACKLIGHT_SET_CURRENT	CTL_CODE(FILE_DEVICE_UNKNOWN, 5, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_BKL_SET_ENABLE		CTL_CODE(FILE_DEVICE_UNKNOWN, 0x0, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_BKL_GET_ENABLE		CTL_CODE(FILE_DEVICE_UNKNOWN, 0x1, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_BKL_SET_INTENSITY		CTL_CODE(FILE_DEVICE_UNKNOWN, 0x2, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_BKL_GET_INTENSITY		CTL_CODE(FILE_DEVICE_UNKNOWN, 0x3, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_MISC_CONTROL_GET_LIGHTSENSOR		CTL_CODE(FILE_DEVICE_UNKNOWN, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_MISC_CONTROL_GET_USBSTATE     	CTL_CODE(FILE_DEVICE_UNKNOWN, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_MISC_CONTROL_GET_GPSMODE     		CTL_CODE(FILE_DEVICE_UNKNOWN, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)


#define ATLMSG_SLEEP		0x0001
#define ATLMSG_WAKEUP		0x0002
#define ATLMSG_USBMOUNT		0x0004
#define ATLMSG_USBDISMOUNT	0x0008
#define ATLMSG_LIGHTON		0x0010
#define ATLMSG_LIGHTOFF		0x0020
#define ATLMSG_SLEEP_CANCLE	0x0040
#define ATLMSG_PREDICTION          0x0080

#ifndef UNDER_CE
typedef enum _CEDEVICE_POWER_STATE {
	PwrDeviceUnspecified = -1,
	D0 = 0,
	D1,
	D2,
	D3,
	D4,
	PwrDeviceMaximum
} CEDEVICE_POWER_STATE, *PCEDEVICE_POWER_STATE;
#endif

typedef enum{
	GPS_STATE_UNKNOWN = -1,
	PredictionEnter =0,
	PredictionLeave =1
}GPS_PREDICTION_EVENT;

typedef enum {
    NoSWevent,
    CancelSWevent,
    PBSleep,
    ACSleep,
    BatterySleep,
    GPSStaticSleep,
    SecretSleep,    
    ACWakeup,
    PBWakeup,
    SecretWakeup    
} PM_SLEEP_WAKEUP_EVENT;

////////////////////////TEMP FOR USB-NAVI COMMUNICATION////////////////////
typedef
enum USBConnectType
{
    UCT_Unknown=0,
    UCT_MSC,
    UCT_ActiveSync,
    UCT_MTPSync,
    UCT_Last    //Last item, reserved for flag like using.
}USBConnectType;

typedef
enum USBConnectStatus
{
    UCS_Unknown=0,
    UCS_CONNECT,
    UCS_DISCONNECT,
    UCS_Last    //Last item, reserved for flag like using.
}USBConnectStatus;

typedef struct _USB_CONNT_EVENT_DATA_STRT_
{
	BYTE bConnectType;
	BYTE bConnectStatus;
	USHORT usData;
}USB_CONNT_EVENT_DATA_STRT;

typedef union _USB_CONNT_EVENT_DATA_
{
	USB_CONNT_EVENT_DATA_STRT AsStruct;
	DWORD AsDWord;
}USB_CONNT_EVENT_DATA;
////////////////////////TEMP FOR USB-NAVI COMMUNICATION////////////////////

#define NAVI_API_BKL_HIGHEST		0x00010000
#define NAVI_API_BKL_CURRENT		0x00020000
#define NAVI_API_BKL_LEVEL_MASK		0xFFFF0000

BOOL AtlasNotifyRegister(HWND hWin,WORD Type, WORD MsgInfo, UINT WMNotify);
BOOL AtlasNotifyDeregister(HWND hWin,WORD Type, WORD MsgInfo);
BOOL AtlasNotifyRespond(HWND hWin,WORD Type, WORD MsgInfo);
BOOL AtlasGetLightLevel (PULONG pLevel);
BOOL AtlasGetUSBState(PULONG pState);

BOOL AtlasGetBKLightLevel(PULONG pBklGetLevel);
BOOL AtlasSetBKLightLevel(PULONG pBklSetLevel);
BOOL AtlasGetMaxBKLightLevel(PULONG pBklGetLevel);
BOOL AtlasSetMaxBKLightLevel(PULONG pBklSetLevel);

VOID AtlasTurnOnBacklight(BOOL bOn );
INT  AtlasSetDisplayState(BOOL bOn);
VOID AtlasSetSysSleep();
BOOL AtlasGetACTimeOut(PULONG pACGetTime);
BOOL AtlasGetBattTimeOut(PULONG pBattGetTime);
BOOL AtlasSetACTimeOut(PULONG pACSetTime);
BOOL AtlasSetBattTimeOut(PULONG pBattSetTime);
//BOOL AtlasSetDisplayTimeOut(PULONG pDisplaySetTime);
BOOL AtlasSetAudioVolume(PULONG pLevel);   
BOOL AtlasGetAudioVolume(PULONG pLevel);
BOOL AtlasSetAudioMaxLevel(PULONG pLevel);   
BOOL AtlasGetAudioMaxLevel(PULONG pLevel);
DWORD AtlasVolumeTuning(BOOL bOn );
BOOL AtlasSetUUID(PVOID pUUID, DWORD dwBufSize );
BOOL AtlasGetBSPVersion(TCHAR * pVerStr);
BOOL AtlasTchCalibration();
BOOL AtlasCalibrateGlideSensor();
BOOL AtlasGetGPSMode (PULONG pState);
#endif //#ifndef _NAVI_API_H
